<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!---->
    <script type="text/javascript">
      /*  var patt1=new RegExp("e","g");//全局找e  g是为了全局的找
        do//循环才能找到
        {
            result=patt1.exec("The best things in life are free");
            document.write(result);
        }
        while (result!=null)

        var reg=new RegExp("[1-9][0-9]{10}","g")
        do {
            result=reg.exec("1584522655484dsf65d18s5fda122144538568402")
            document.write(result+",")
        }while (result!=null)*/


        /*match*/
        var str="hello world!";
        document.write(str.match("world")+"<br>")//全匹配
        document.write(str.match("World")+"<br>")
        document.write(str.match("wo0rld")+"<br>")
        document.write(str.match("world!")+"<br>")

        var str_regex="kungi@qq2.com";
        document.write(str_regex.match("/\S{1,10}@\w{2,}.\w{3}/g")+"<br>")

      var str="1 plus 2 equal 3"
      document.write(str.match(/\w+/g))
    </script>
</head>
<body>

</body>
</html>